]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: Use MetaWindow.has_attached_dialogs()
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 30 Nov 2021 17:31:19 +0000 (18:31 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 21 Dec 2021 12:11:33 +0000 (12:11 +0000)
Now that MetaWindow itself exposes a method for checking for
attached dialogs, we can use that instead of our own helper
method.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2054>

js/ui/windowManager.js

index 72cadd9ac0a25567eb53edcad32c9d2d82f57daa..d3c4d26552b7a09cbc4d647e9eb27ac93def634c 100644 (file)
@@ -1397,22 +1397,8 @@ var WindowManager = class {
         }
     }
 
-    _hasAttachedDialogs(window, ignoreWindow) {
-        var count = 0;
-        window.foreach_transient(win => {
-            if (win != ignoreWindow &&
-                win.is_attached_dialog() &&
-                win.get_transient_for() == window) {
-                count++;
-                return false;
-            }
-            return true;
-        });
-        return count != 0;
-    }
-
-    _checkDimming(window, ignoreWindow) {
-        let shouldDim = this._hasAttachedDialogs(window, ignoreWindow);
+    _checkDimming(window) {
+        const shouldDim = window.has_attached_dialogs();
 
         if (shouldDim && !window._dimmed) {
             window._dimmed = true;
@@ -1558,7 +1544,7 @@ var WindowManager = class {
         }
 
         if (window.is_attached_dialog())
-            this._checkDimming(window.get_transient_for(), window);
+            this._checkDimming(window.get_transient_for());
 
         let types = [Meta.WindowType.NORMAL,
                      Meta.WindowType.DIALOG,